package genetic.treevisualizer;

import java.awt.*;

public class METreeNodeRenderer implements TreeNodeRenderer{

	//This implementation basis the shade of the node on the level
	//but you may employ any property of your node.
	/*
	public Color getNodeColor(Object node, int level) {
		Color out = Color.black;
		if (level <= 7) {
			int amt = (8 - level) * 32;
			if (amt >= 256) amt = 255;
			out = new Color(amt, amt, amt);
		}
		return out;
	}
	*/

	public Color getNodeColor(Object node, int level) {
		String name = node.getClass().getName();
		Color out = Color.white;
		if (name.equals("genetic.treenodes.Constant")) {out = new Color(255, 0, 0);}
		if (name.equals("genetic.treenodes.Variable")) {out = new Color(255, 255, 0);}
		
		return out;
	}

}
